<!DOCTYPE html>
<html lang="en">
<head>
    <title>朝圣"菱"距离</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <link rel="stylesheet" type="text/css" href="css/animate.css" />
	<link rel="stylesheet" type="text/css" href="css/BeAlert.css" />
    
    <script type="text/javascript" src="../js/jquery-1.7.2-min.js"></script>
    
    <script type="text/javascript" src="js/media.js"></script>
	<script type="text/javascript" src="js/BeAlert.js"></script>
    
	<script type="text/javascript" src="../js/common/common.js"></script>
    <script type="text/javascript" src="../js/common/wechatCommon.js"></script>
    
    <style>
		.fixed {
			position: fixed;
		}
	</style>
</head>

<!--移动端版本兼容 -->

<body>
	<div class="page2 fixed">
		<div class="content">
			<div class="title"></div>
			<div class="inner">
				<div class="cities"></div>
				<div class="prompt2">温馨提示：本场秒获的券需在<span id="lotteryEndActivityDates">2017年08月31日</span>前激活</div>
				<div class="success clearfix">
					<div class="dianziquanID">电子券 No.<span id="lotteryCode">000000000000001</span> </div>
	                <div class="state_icon">
	                    <div class="state state_noshenghe" id="chapter"></div>
	                </div>
	                <div class="endDate">合影上传截止日期：<span id="lotteryEndActivityDate">2017年08月31日</span></div>
	                <div class="photo_upload"></div>				
				</div>
				<div class="rules2">
					<div class="rules_content">
						<span>1.秒杀：</span>
						2017/07/25-2017/08/20每日10:00、16:00整点秒杀900元现金电子抵用券；
					</div>
					<div class="rules_content">
						<span>2.激活：</span>
						获得900元现金抵用券的车主需在指定期限内上传人车、驿站名的合影1张，审核通过后即可激活该券;
					</div>
					<div class="rules_content">
						<span>3.使用（2选1）：</span>
						已激活的900元现金抵用券可在全国认证的任意广汽三菱4S店消费使用或兑换丽江驿站免费住宿3晚。
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="dialog">
		<div class="dialog_mask"></div>
		<div class="modal">
			<div class="close"></div>
		</div>
	</div>
	<script type="text/javascript">
	
		var rootPath = getRootPath();
	
		$(function(){
			
			if(getUrlParam("isInit") != "false"){
				$(".dialog").hide();
		        $(".page2").removeClass("fixed");
			}
			
			getUserLottery();
		});
		
		function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]); return null; //返回参数值
        }
		
		function getUserLottery(){
			$.ajax({
				headers: {'Cookie' : document.cookie },
				type:"POST", 
		        url:rootPath + "/pointActivity/api/v1/getUserLottery",
		        //url : "http://172.16.100.88:9013/pointActivity/api/v1/getUserLottery",
		        dataType:"json",
		        async: false,
		        contentType:"application/json",
		        data:null, 
		        success:function(json){
		        	console.log(json);
		        	if(null == json){
		        		alert("没有奖券你是怎么进来的.!联系系统管理员掰扯掰扯.!");
		        	} else {
		        		$("#lotteryCode").text(json.LOTTERY_CODE);
		        		$("#lotteryEndActivityDate").text(json.LOTTERY_ACTIVATION_END_SHOW);
		        		$("#lotteryEndActivityDates").text(json.LOTTERY_ACTIVATION_END_SHOW);
						if(json.ENABLE_STATUS == "TRUE" && json.AUDIT_STATUS == 3){
							$("#chapter").attr("class","state state_nojihuo");
							$(".photo_upload").attr("onclick","uploadPhoto()");
		        		} else {
		        			$("#chapter").attr("class","state state_noshenghe");
		        			$(".success.clearfix").attr("class","success_01 clearfix");
		        			$(".endDate").hide();
		        			$(".photo_upload").hide();
		        			if(json.AUDIT_STATUS == 0){
		        				$("#chapter").attr("class","state state_yijihuo");
		        			} else if(json.AUDIT_STATUS == 2){
		        				$("#chapter").attr("class","state state_nopass");
		        			} else if(json.AUDIT_STATUS == 1){
		        				$("#chapter").attr("class","state state_nojihuo");
								$(".photo_upload").attr("onclick","uploadPhoto()");
								$(".success_01.clearfix").attr("class"," success clearfix");
			        			$(".endDate").show();
			        			$(".photo_upload").show();
		        			}
		        		}
		        	}
		        }
		     });
		}
		
		function uploadPhoto(){
			window.location.href = rootPath + "/views/ui.html";
		}
		
	    $(".close").on("touchend",function (e){
	        e.preventDefault();
	        $(".dialog").hide();
	        $(".page2").removeClass("fixed");
	    });
	</script>
</body>
</html>